<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>会员</title>
    <link rel="stylesheet" href="../fonts/element-icons.ttf">
    <link rel="stylesheet" href="../fonts/element-icons.woff">
    <link rel="stylesheet" href="../css/ele.css">
    <script src="../js/vue.js"></script>
    <script src="../js/axios.min.js"></script>
    <script src="../js/url.js"></script>
    <!-- <script src="../node_modules/element-ui/lib/index.js"></script> -->
    <script src="../js/ele.js"></script>
    <link rel="stylesheet" href="../css/public.css">
    <script src="../js/Mixin.js"></script>
    <script src="../js/crypto-js.min.js"></script>
    <script src="../js/aes.js"></script>
    <link rel="stylesheet" href="../css/memberNewUser.css">
    <script src="../js/qrcode.js"></script>
</head>

<body>
    <div id="app">
        <!-- 头部 -->
        <header>
            <div class="heart ng-scope" ng-controller="HeartForm">
                <div class="logo" @click="goHome">
                    <img src="../image/index/logo.png" alt="" style="width: 123px;height: 59px;margin-top: 8px;">
                    <div style="width: 1px;
                height: 24px;
                background: #333333;
                margin-top: 7%;
                margin-right: 9px;"></div>
                    <div>留学大数据，智能选校专家</div>
                </div>
                <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="menuSelect">
                    <el-submenu index="1">
                        <template slot="title">产品</template>
                        <div class="chanpin">
                            <ul class="unav">
                                <li :class="[activenavliIndex==0?'activenavli':'']" @click="unavclcik(0)">全球院校库</li>
                                <li :class="[activenavliIndex==1?'activenavli':'']" @click="unavclcik(1)">智能选校系统</li>
                            </ul>
                            <div style="margin-left: 53px;" v-if="activenavliIndex==0">
                                <div class="ltitle"> <img src="../image/index/quanqiu.png" alt=""
                                        style="width: 26px;vertical-align: bottom;">
                                    全球院校库</div>
                                <div class="lcontent">
                                    <!-- <div> -->
                                    <ul v-for="(item,index) in headerList" :key="index">
                                        <li>{{item.name}}</li>
                                        <li v-for="i in item.universityItems" @click="qqyxkClick(item.id,i.id)">
                                            {{i.name}}院校库
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div style="margin-left: 53px;" v-if="activenavliIndex==1">
                                <div class="ltitle"> <img src="../image/index/quanqiu.png" alt=""
                                        style="width: 26px;vertical-align: bottom;">
                                    智能选校系统</div>
                                <div class="lcontent">
                                    <div>
                                        <ul>
                                            <li v-for="(i,index) in znxxxtList" :key="index" style="font-size: 12px;"
                                                @click="znxxxtSearch(i)">
                                                {{i.name}}</li>

                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </el-submenu>
                    <el-menu-item index="2">会员</el-menu-item>
                    <el-menu-item index="3">套餐</a></el-menu-item>
                    <el-menu-item index="4">合作</a></el-menu-item>

                </el-menu>
                <div class="user_box" id="user_box">
                    <div v-if="isLogin">
                        <el-dropdown trigger="click">
                            <span class="el-dropdown-link">
                                <img :src="HeadImageUrl" alt=""
                                    style="width: 33px;height: 33px; vertical-align: middle;margin-right: 8px;">
                                {{nickname}}<i class="el-icon-arrow-down el-icon--right"></i>
                            </span>
                            <el-dropdown-menu slot="dropdown">
                                <el-dropdown-item icon="el-icon-user" @click.native="goUser">个人中心</el-dropdown-item>
                                <el-dropdown-item icon="el-icon-layout"
                                    @click.native="layoutLogin">退出登录</el-dropdown-item>
                            </el-dropdown-menu>
                        </el-dropdown>
                    </div>
                    <div v-else @click="login"><img src="../image/index/user.png" alt=""
                            style="width: 22px;vertical-align: middle;"> <a href="./login.html">登录</a>/ <a
                            href="./register.html">注册</a> </div>
                </div>
            </div>
        </header>
        <div class="jybContent">
            <div style="text-align: center;">
                <img v-if="basicInfo.membType==22" src="../image/member/sviptitle.png" alt=""
                    style="width: 273px;margin-bottom: 98px;" />
                <img v-else src="../image/member/vtitle.png" alt="" style="width: 273px;margin-bottom: 98px;" />
            </div>
            <div style="display: flex;flex-wrap: wrap;">
                <div class="item" v-for="item in codepackagepricelists">
                    <img src="../image/member/jyb.png" alt=""
                        style="position: absolute;width: 112px;top: -45px;left: 35%;">
                    <img src="../image/member/badge_discount .png" alt="" v-if="item._type=='vipnew'"
                        style="width: 64px;position: absolute;top: 23px;right: 15px;">
                    <div style="font-weight: 600;font-size: 27px;">{{item.name}} </div>
                    <p style="font-size: 12px;color: #222222;margin-top: 11px;">可在智能选校系统解锁{{item.codeNumber}}次数据版块</p>
                    <div style="font-size: 20px;margin-top: 13px;">￥<span
                            style="font-size: 40px;">{{item.price}}</span>/次</div>
                    <button v-if="basicInfo.membType==0||basicInfo.membType==1"
                        style="width: 138px;height: 33px;background: #eee;border-radius: 25px 25px 25px 25px;margin-top: 8px;font-size: 12px;font-weight: 600;">立即充值</button>
                    <button v-else
                        style="width: 138px;height: 33px;background: #0094FF;border-radius: 25px 25px 25px 25px;margin-top: 8px;font-size: 12px;font-weight: 600;"
                        @click="goPay(item)">立即充值</button>
                    <div style="margin-top: 13px;font-size: 12px;color: #666666;">套餐权益</div>
                    <div style="width: fit-content; text-align: left; margin: auto;">
                        <div style="margin-top: 13px;font-size: 12px;color: #666666;">
                            <img src="../image/member/agree.png" alt=""
                                style="width: 16px;margin-right: 7px;vertical-align: middle;">获得{{item.codeNumber}}次Code
                        </div>
                        <div style="margin-top: 13px;font-size: 12px;color: #666666;"><img
                                src="../image/member/agree.png" alt=""
                                style="width: 16px;margin-right: 7px;vertical-align: middle;">{{item.validityDay}}天有效期
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <footer>2023-2024 非攻留学大数据 版权所有 feigongdata.com 浙ICP备2024101258号-1</footer>
        <div class="dialog" v-if="pay">
            <div class="tbg">
                <div style="font-weight: 500;
                font-size: 17px;
                color: #FFF6D6;padding: 37px 0;text-align: center;">支付订单</div>
                <div class="diaText">
                    <div>
                        <p>购买详情 :</p>
                        <div>{{payInfo.name}}</div>
                    </div>
                    <div>
                        <p>实付金额 :</p>
                        <div><span>￥</span>{{payInfo.price}}</div>
                    </div>
                    <div>
                        <p>选择支付方式 :</p>
                    </div>
                    <div class="zf">
                        <img src="../image/customize/zfbActive.png" alt="" v-if="isZfb">
                        <img src="../image/customize/weixin.png" alt="" style="margin-left: 20px;" v-if="isZfb"
                            @click="weixnPay">
                        <img src="../image/customize/zfb.png" alt="" v-if="!isZfb" @click="zfbPay">
                        <img src="../image/customize/weixinActive.png" alt="" style="margin-left: 20px;" v-if="!isZfb">
                    </div>
                    <div class="qrcode" id="qrcode" ref="qrcode" style="margin-left: 50%;transform: translateX(-26%);"
                        v-if="!isZfb"> </div>
                    <!-- <iframe src="./zfb.html" frameborder="0"></iframe> -->
                    <!-- <div v-else v-html="zfbCode"></div> -->
                    <iframe v-else :srcdoc="zfbCode" frameborder="no" border="0" marginwidth="0" marginheight="0"
                        scrolling="no" width="200" height="200" style="overflow: hidden;width: 300px;
                        height: 300px;
                        transform: scale(0.4);
                        margin-top: -23%;
                        margin-left: 8%;
                        margin-bottom: -28%;">
                    </iframe>


                    <div class="btn"> <button @click="zhifuSuccess">支付完成</button> <button
                            style="background: #B0B0B0;margin-left: 20px;" @click="()=>pay=false">取消支付</button></div>
                </div>
            </div>
        </div>
    </div>
</body>
<script>
    var app = new Vue({
        mixins: [myMixin],
        el: "#app",
        data() {
            return {
                codepackagepricelists: [],
                pay: false,
                totalPrice: '',
                isZfb: false,
                payInfo: {},
                zfbCode: '',
                order_id: ''
            }
        },
        created() {
            http('productdata/codepackagepricelists', 'post').then(res => {
                let data = JSON.parse(Decrypt(res.data))
                console.log('codepackagepricelists', data);
                this.codepackagepricelists = data
            })
        },
        methods: {
            goPay(item) {
                this.payInfo = item
                this.pay = true
                this.weixnPay()
            },
            weixnPay() {
                this.isZfb = false
                http('tradedata/goodsorder?pay_type=2', 'post', {
                    goodsIdItems: [this.payInfo.id]
                }).then(res => {
                    console.log('wx', JSON.parse(Decrypt(res.data)));
                    let data = JSON.parse(Decrypt(res.data))
                    this.order_id = data.OrderId
                    this.$nextTick(() => {
                        this.$refs.qrcode.innerHTML = ''
                        this.createCode(data.payQrCode);
                    })
                })
            },
            zfbPay() {
                this.isZfb = true
                http('tradedata/goodsorder?pay_type=1', 'post', {
                    goodsIdItems: [this.payInfo.id]
                }).then(res => {
                    let data = JSON.parse(Decrypt(res.data))
                    this.zfbCode = data.payQrCode
                    // .split('<script>')[0]
                    console.log('this.zfbCode', this.zfbCode);
                    this.order_id = data.OrderId
                    console.log('zfb', this.zfbCode);
                    this.$nextTick(() => {
                        // this.$refs.qrcode.innerHTML = ''
                        // document.forms['alipaysubmit'].submit();
                    })
                })
            },
            createCode(text) {
                this.qrcode = new QRCode(this.$refs.qrcode, {
                    text: text,
                    width: 108,
                    height: 108,
                    colorDark: "#000",
                    colorLight: "white",
                    correctLevel: QRCode.CorrectLevel.H
                });
            },
            zhifuSuccess() {
                http('tradedata/orderquery?order_id=' + this.order_id, 'post').then(res => {
                    let data = JSON.parse(Decrypt(res.data))
                    console.log(data);
                    // success = 0, fail = -1, wait = 1,
                    if (data.payStatus == 0) {
                        this.$message.success('支付成功')
                        this.pay = false
                        location.href = './memberLogin.html'
                    } else if (data.payStatus == -1) {
                        this.$message.error('支付失败')

                    } else if (data.payStatus == 1) {
                        this.$message.warning('等待中...')
                    }
                })
            }

        }
    })
</script>

</html>